/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmconsest.java
 *
 * Created on 19/02/2011, 12:26:13 AM
 */
package interfaz1;

import java.awt.Frame;
import javax.swing.JOptionPane;

/**
 *
 * @author CLIENTE
 */
public class Frmconsest extends javax.swing.JFrame {

    /** Creates new form Frmconsest */
    public Frmconsest() {
        initComponents();

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblconsest = new javax.swing.JLabel();
        lblcedconsest = new javax.swing.JLabel();
        lblnomconsest = new javax.swing.JLabel();
        lblapconsest = new javax.swing.JLabel();
        txtcedconsest = new javax.swing.JTextField();
        txtnomconsest = new javax.swing.JTextField();
        txtapconsest = new javax.swing.JTextField();
        btnbuscarconsest = new javax.swing.JButton();
        btncancconsest = new javax.swing.JButton();
        btnsalirconsest = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Estudiantes");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblconsest.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        lblconsest.setText("Buscar Estudiante");
        getContentPane().add(lblconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 30, -1, -1));

        lblcedconsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblcedconsest.setText("Cedula:");
        getContentPane().add(lblcedconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 80, 50, 20));

        lblnomconsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblnomconsest.setText("Nombre:");
        getContentPane().add(lblnomconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 120, 50, 20));

        lblapconsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblapconsest.setText("Apellido:");
        getContentPane().add(lblapconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 160, 50, 20));

        txtcedconsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtcedconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 80, 140, -1));

        txtnomconsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtnomconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 120, 140, -1));

        txtapconsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtapconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 160, 140, -1));

        btnbuscarconsest.setText("Buscar");
        btnbuscarconsest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnbuscarconsestActionPerformed(evt);
            }
        });
        getContentPane().add(btnbuscarconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 80, -1, -1));

        btncancconsest.setText("Cancelar");
        btncancconsest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancconsestActionPerformed(evt);
            }
        });
        getContentPane().add(btncancconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 240, -1, -1));

        btnsalirconsest.setText("Salir");
        btnsalirconsest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirconsestActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirconsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 240, 70, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-336)/2, 416, 336);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirconsestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirconsestActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_btnsalirconsestActionPerformed

    private void btnbuscarconsestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnbuscarconsestActionPerformed
        // TODO add your handling code here:
        Estudiante miestudiante = FrmOperacionesseccion.getMiseccion().BuscarEstudiante(txtcedconsest.getText());
        if (miestudiante != null) {

            txtapconsest.setText(miestudiante.getApellido());
            txtcedconsest.setText(miestudiante.getCedula());
            txtnomconsest.setText(miestudiante.getNombre());
            JOptionPane.showMessageDialog(new Frame(), "Resultado de la busqueda", "Aviso", JOptionPane.PLAIN_MESSAGE);
            
        } else {
            JOptionPane.showMessageDialog(new Frame(), "El Estudiante no Exite", "Aviso", JOptionPane.PLAIN_MESSAGE);
        }
    }//GEN-LAST:event_btnbuscarconsestActionPerformed

    private void btncancconsestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncancconsestActionPerformed
        // TODO add your handling code here:
        txtapconsest.setText("");
        txtcedconsest.setText("");
        txtnomconsest.setText("");
    }//GEN-LAST:event_btncancconsestActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Frmconsest().setVisible(true);


            }
        });


    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnbuscarconsest;
    private javax.swing.JButton btncancconsest;
    private javax.swing.JButton btnsalirconsest;
    private javax.swing.JLabel lblapconsest;
    private javax.swing.JLabel lblcedconsest;
    private javax.swing.JLabel lblconsest;
    private javax.swing.JLabel lblnomconsest;
    private javax.swing.JTextField txtapconsest;
    private javax.swing.JTextField txtcedconsest;
    private javax.swing.JTextField txtnomconsest;
    // End of variables declaration//GEN-END:variables
}
